package com.dnr.arch.kernel.services.logging;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.dnr.arch.kernel.api.InterfaceToLogging;

public class DefaultLoggingDriver implements InterfaceToLogging{

	protected static Logger logger = Logger.getLogger("Default");
	private static DefaultLoggingDriver instance =null;
	
	public static DefaultLoggingDriver getInstance(){
		if(instance == null){
			instance = new DefaultLoggingDriver();
		}
		return instance;
	}
	
	private DefaultLoggingDriver(){
		try {
			Handler handler = new FileHandler("D:/default.log");
			logger.addHandler(handler);
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Override
	public void log(String Module, Level level, String message) {
		logger.log(level,message);
	}

}
